/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

/**
 * <p>Project: javaseapp - Str1
 * <p>Powered by webrx On 2021-08-06 10:36:52
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Str6 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        var a = "hello";
        var b = "world";
        var c = a.concat(b).concat("java-world").toUpperCase();
        System.out.println(c);
        System.out.println(c.substring(10));//JAVA
        System.out.println(c.substring(10, 12));//JA 不包括索引12

        //找不到，返回-1
        System.out.println(c.indexOf("word"));//-1
        System.out.println(c.indexOf("WORLD"));//5
        System.out.println(c.lastIndexOf("WORLD"));//15  从字符串尾找相关的字符串出现位置，找到返回正常的位置

        System.out.println(c.contains("HELLO")); //true

        //split() 将字符串每个字符，组成char[] 返回
        System.out.println(Arrays.toString("java".split("")));

        String wks = "日,一,二,三,四,五,六";
        String[] ws = wks.split(",");
        System.out.println(Arrays.toString(ws));

    }
}
